package com.ybkj.daijia.server.service;

import com.ybkj.daijia.chart.TableOrderMonthVo;
import com.ybkj.daijia.common.CompanyOrderVo;
import com.ybkj.daijia.common.DriverOrderDetailVo;
import com.ybkj.daijia.common.DriverOrderVo;
import com.ybkj.daijia.common.MemberOrderVo;
import com.ybkj.daijia.common.OrderFromSourceVo;
import com.ybkj.daijia.common.PageVo;
import com.ybkj.daijia.common.Result;
import com.ybkj.daijia.page.Page;
import com.ybkj.daijia.server.errand.ErrandAcKey;
import com.ybkj.daijia.server.errand.ErrandOrderTypeOtherServices;
import com.ybkj.daijia.server.errand.ErrandOrderTypeTips;
import com.ybkj.daijia.server.errand.ErrandPay;
import com.ybkj.daijia.server.errand.Order;
import com.ybkj.daijia.server.errand.Order.PayTypeDetails;
import com.ybkj.daijia.server.errand.OrderOrbit;
import com.ybkj.daijia.server.errand.OrderRefuse;
import com.ybkj.daijia.server.errand.OrderTemp;
import com.ybkj.daijia.server.errand.OrderType;
import com.ybkj.daijia.server.errand.PayRecordOrder;
import com.ybkj.daijia.server.mc.Passenger;
import com.ybkj.daijia.server.mc.PassengerAddress;
import com.ybkj.daijia.server.mc.PassengerConcats;
import com.ybkj.daijia.server.model.Area;
import com.ybkj.daijia.server.model.ChartDay;
import com.ybkj.daijia.server.model.ChartMonth;
import com.ybkj.daijia.server.model.ChartYear;
import com.ybkj.daijia.server.model.Driver;
import com.ybkj.daijia.server.model.Rate;
import com.ybkj.daijia.server.sales.Coupon;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface ErrandService {

    Page<Order> queryErrandOrder(Long companyId, Date start, Date end, String orderType,
        String param, String status, String orderby);

    Result<Order> save(Order order);

    Result<OrderTemp> saveTemp(OrderTemp orderTemp);

    Result<Order> cancelOrder(Order order, String cancelCause);

    Order findOne(Long id);

    OrderTemp findOneTemp(Long id);

    void remark(Long id, String memo);

    void review(Long id, String content, Double score);

    Result<Order> paidan(Driver driver, Order order);

    Page<OrderRefuse> queryRefuses(Long companyId, Date start, Date end, String param);

    Long countBusyAmount(Long id);

    List<ErrandAcKey> feelist();

    Result<ErrandAcKey> addNewfee(String name, String acKey);

    Result<ErrandPay> addNewfeeContent(String city, String content, Long acKeyId);

    ErrandPay findOneErrandPay(Long id);

    Result<ErrandPay> updateFeecontent(Long id, String city, String content);

    Result<ErrandAcKey> deleteFee(Long id);

    Result<ErrandPay> deleteFeeContent(Long id);

    Result<Order> callback(Long id, String cause);

    List<PassengerConcats> findPassengerConcats(Long passengerId);

    PassengerAddress findPassengerToPlace(Long passengerId, Integer type);

    Result<Order> completeTask(Order order);

    List<Order> selectCuidan();

    void closeCuidan(Long orderId);

    ChartYear dataForYear(Integer year, Long companyId);

    ChartMonth errandDataForMonth(Integer year, Integer month,
        Long companyId);

    List<TableOrderMonthVo> tableOrderMonth(Integer year, Long companyId);

    ChartDay errandDataForDay(Integer year, Integer month, Integer day,
        Long companyId);

    List<Order> findMonthOrder(Integer year, Integer month);

    PageVo<OrderFromSourceVo> orderFromSource(Date start, Date end,
        Long companyId);

    PageVo<CompanyOrderVo> companyOrder(Date start, Date end);

    PageVo<DriverOrderVo> errandIntroduce(Long companyId, Date start, Date end);

    PageVo<MemberOrderVo> errandMemberOrder(Date startTime, Date endTime, Long companyId,
        Long gradeId, Integer type);

    Map<String, Object> getPrice(Area area, Double distance, Integer time);

    Page<Map<String, Object>> orderListData(String orderNumber, String clientPhone,
        String driverPhone, Long companyId,
        String companyName, String startTime, String endTime, String allorderType,
        String allErrandOrderType,
        String allstatus, Integer page, Integer rows, String treatment, String startFinishTime,
        String endFinishTime) throws ParseException;

    List<Map<String, Object>> orderListDataExport(String orderNumber, String clientPhone,
        String driverPhone, Long companyId,
        String companyName, String startTime, String endTime, String allorderType,
        String allErrandOrderType,
        String allstatus, String treatment, String startFinishTime, String endFinishTime)
        throws ParseException;

    PageVo<DriverOrderDetailVo> driverOrderDetail(Long driverId, Date start, Date end);

    List<OrderType> queryOrderType(Long companyId);

    Page<Map<String, Object>> queryOrderTypeByParams(String companyName, String orderTypeName);

    OrderType createOrderType(
        Long companyId, String companyName, Long areaId, String typeName, Boolean endAddress,
        Boolean errandValuationMethod, String startHint, String endHint,
        String errandOrderTypeDetaileds, String typepicture, String otherServices, String tips,
        String allowTips);

    Map<String, Object> getNewPrice(Long areaId, Double mileage, Integer time, Date dateTime,
        Double weight);

    int updateOrderType(Long id, Long areaId, Long companyId, String companyName, String typeName,
        Boolean endAddress, Boolean errandValuationMethod, String startHint, String endHint,
        String errandOrderTypeDetaileds, String typepicture, String otherServices, String tips,
        String allowTips);

    Map<String, Object> deleteOrderType(Long typeId);

    Result<Order> confirmTask(Order order, String xml, String memo);

    Result<Order> completeTaskNewV3(Order order, Passenger passenger, Driver driver, String string,
        String payType, BigDecimal hasPayed);

    Result<PayRecordOrder> createPayRecordOrder(PayRecordOrder payRecordOrder);

    Result<PayRecordOrder> payRecordOrderTreatment(PayRecordOrder payRecordOrder);

    PayRecordOrder findOnePayRecordOrder(Long orderId);

    List<Map<String, Object>> queryByEmployId(Long employId, String status, Double latitude,
        Double longitude);

    List<Order> listByEmployId(Long employId, String status, Double latitude, Double longitude);

    void acceptInfoFee(Driver driver, Order order);

    OrderOrbit findOrbitByOrderId(Long id);

    List<Order> listNewOrders();

    List<Order> findActivedOrdersByDriver(Long id);

    Map<String, Object> findRate(Long driverid, Integer page,
        Integer limit);

    Rate findRateOne(Long id);

    void deleteRateOne(Long id);

    long countFinishedByPassengerAndFinishTime(Long passengerId, String orderFromSources,
        Date startDate, Date endDate);

    Result<Order> updateRealMoney(Order order, BigDecimal couponMoney, BigDecimal cashMoney,
        BigDecimal signMoney,
        BigDecimal balanceMoney, BigDecimal alipayMoney, BigDecimal weixinMoney,
        BigDecimal driverMoney,
        BigDecimal memberMoney, String content);

    List<Order> findOrderFinishedBycompanyId(
        Long companyId, Date start, Date end);

    long countNotPayByPassenger(Long passengerId);

    Page<Order> findByDriverAndFinishTime(Long employId, Date begin, Date end, Integer page,
        Integer limit);

    //满足金额大于lowestMoney的完成订单
    List<Order> findReward(Long driverId, BigDecimal lowestMoney, Date start, Date end);

    long countActiveByPassenger(Long passengerId);

    long countTodayOrderByPassenger(Long passengerId);

    PageVo<DriverOrderDetailVo> driverOrderDetailCount(Long driverId, Date start, Date end);

    List<OrderType> findByTypeName(Long companyId, String typeName);

    OrderType findByTypeId(Long id);

    List<OrderType> queryTypeV4(Long companyId, String appKey);

    void updateOrderPayed(Long id, String ifPayed, Double payed, String payTypeDetails);

    //更新订单预支付方式，金额，
    Result<Order> updatePayStatus(Long id, PayTypeDetails prePayType, BigDecimal shouldPayMoney,
        BigDecimal coupon_mony);

    ErrandOrderTypeOtherServices getOtherServiceById(String id);

    ErrandOrderTypeTips getTipsById(String id);

    Order tempToForever(Long id, PayTypeDetails prePayType, Coupon coupon);

    void backMoney(Long orderId);

    Result<Order> autoCallback(Order order, Driver driver);

    //查询车型数量
    Long countTypeAmount(Long companyId);

    Long getCreateOrderNumber(Long passengerId, String appKey);


}
